home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
176-200
/
scopedisk186
/
aplot2d
/
aplot2d.doc
< prev
next >
Wrap
Text File
|
1995-03-19
|
16KB
|
505 lines
Amiga Plot 2D v 1.0
(c)copyright 1991
Amiga Plot 2D is not in the Public Domain. All rights are
retained. Amiga Plot 2D is distributed via Shareware. Simply put,
Shareware means you get to use the fully functional program
before you buy. If you find Amiga Plot 2D to be useful for your
needs, or you wish to help further its' developement, then you
should register your copy of the program. To register send a
check or money order for $20 to the address given below.
Joe Martin
2702 Willow Grove Lane
Ft. Walton Bch. FL 32547
904-862-7108(voice)
Amiga Plot 2D is in its' infancy. I am releasing this
version at this time because the program will grow and mature
only through user input. It is my intention to include every
reasonable request to registered users. Suggestions will be
considered however, from anyone interested enough to write me a
letter. I am a high school math teacher and enjoy computer
programming on the side. I intended Amiga Plot 2D to be an aid to
my students in AlgebraI and above, but it can be applied to any
graphing math need. The data plotting side of Amiga Plot 2D came
into being because of all the interest I am seeing for other data
plotters. Most graphing and data plotting programs seem to fall
short in a very important area, and that is in the user
interface. If we are to foster the exploration of mathematics in
our young people then we should provide a useful tool for that
purpose. A tool that stimulates rather and alienates the user.
This is my ultimate goal in the Amiga Plot series. If you have
not already done so, check out Amiga Plot 3D on your local BBS.
I can be reached via modem on any one of the following
BBS's.
People Link The Hobbit Hole The Amiga Advantage
c/o OSS199 904-243-6219 904-863-8697
c/o Joe Martin c/o Joe Martin
Introduction
Amiga Plot 2D is a graphing and plotting program for any
function or data set that can be described in two dimensions,
(x,y). It provides for 4 functions or data sets on screen at one
time and can mix the two. All parameters are provided in user
gadgets or menu items. These parameters can be saved and loaded
to provide the convienence of groups of related data/functions. A
flexible parser is provided so that mathematical functions can be
explored and graphed while declaring user variables and using
built in constants. The plotting grid can be defined in user
adjustable increments or by the 'auto tics' feature. Text can be
altered and placed anywhere on the grid as well as axis labels
and titles for each plot configuration. User input is both
requested and expected as to future enhancements to Amiga Plot
2D.
Amiga Plot 2D runs under Amiga Dos 1.2, 1.3 or 2.0, and
requires an Amiga 500, 1000, 2000, or 3000 with 1 meg memory.
Starting APlot
Workbench: double click on the AP2 icon
Set stack to at least 10000 bytes if starting from the CLI.
CLI: type 'cd <your aplot dir>' <ret>
type 'run ap2' <ret>
Files & Directories
Aplot expects certain directories to be present in your main
aplot directory.
AParms2D/ for all parameter files. The file
'Default.parms' is loaded at run time.
Data/ for data files
Pics/ for IFF screen files saved from aplot.
PenColors this is a text file that contains a pen color
table
Default.parms a file of default functions or data sets to
automatically loaded on startup.
Main Screen
Aplot 2D uses a hires/interlaced 8 color screen. Aplot will
adapt to overscan sized screens via Workbench 2.0 or morerows.
The screen is divided into a wide top and side border where
the most used features are accessed through gadgets. Some of the
gadgets like 'Plot', 'Stop', 'Clear' and others in the left
border are buttons or toggles. Along the top and upper left are
the entry gadgets.
The plotting area contains the grid markings, axes and
labels.
Minimum/Maximum
At the very top of the aplot screen are 4 long entry gadgets
that determine the plotting dimensions. To change a value, click
in any one of the gadgets. Pressing <ret> will toggle through all
4 of these gadgets over and over. To terminate this function,
press <esc> and the grid will auto adjust to the new dimensions.
Function/Data Entry
Below the Min/Max gadgets are the function entry gadgets.
Before I describe the rules for the parser, let's think about the
functionality of the gadgets. First, know that each function
gadget has an adjacent toggle gadget that determines whether that
particular function or data set will be plotted. The toggle
gadget has other functions which will be discussed later. To
recap, when the 'Plot' gadget is selected, each function/data set
whose adjacent function gadget is active will be plotted in turn
to the plotting grid.
Data can be loaded via the 'Files' menu into each of the 4
function/data sets. When the 'load data' menu item is selected
and a data file chosen, the data will be loaded into the first
function/data set whose funtion gadget is selected. Make sure,
when loading data, that only the one toggle gadget is active for
the chosen data set. Example, if you wish to load a data set into
function/data area named 'i(x)', then only that toggle gadget
should be in its' selected state. If more than one toggle gadget
is selected, then the data will be loaded into the first data
area. Data areas are ordered; f(x), g(x), h(x) and i(x).
Mathematical Parser Conventions
To edit or add a mathematical function to Aplot 2D, select
one of the 4 entry gadgets by clicking the left mouse button
inside the entry gadget. Functions may be entered in upper or
lower case, although all will be converted to lower case when
parsed.
Syntax Rules:
1- Space may be used for readability where appropriate.
2- Up to 12 variables or functions can be specified, using
commas to separate.
3- Function(variable) names can be up to 11 characters in
length, followed by '=' then a mathematical expression.
4- A numerical constant may proceed a variable or paren. to
indicate multiplication. Ex. '2x' means '2 * x'.
5- Any function declaration may include any
variable/function previously declared. Parsing order is
f(x), g(x), h(x), and i(x), with each being parsed left to
right.
6- The last function/variable declared in each of the 4
function gadgets will the one plotted when its' toggle
gadget is in the selected state.
Here is an Example for study and explanation:
a=x^2, b=sin(a), f(x)=3sin(0.1(a+b))-2cos(0.2(a-b))
'a' is a variable declaration/assignment a=x^2.
'b' is a variable declaration/assignment b=sin(a), 'b' uses 'a'.
'f(x)' is the function that will be plotted and uses both 'a' and
'b'.
In the above example the 'f(x)' is optional, also notice
'3sin(x)' which is equivalent to '3 * sin(x)'.
Operation : +,-,*,/ division by zero is trapped
^ to the power of
grouping : ()
functions : abs() absolute value of
sqrt() square root of
sqr() square of
sin() sin of
asin() arc sin of
cos() cosine of
acos() arc cosine of
tan() tangent of
cot() cotangent of
atan() arc tangent of
ln() natural logarithm of
log() base 10 log of
exp() exponential of
Constants: pi = 3.1415926535
e = 2.7182818284
Resolution
The screen entry gadget 'Res' indicates how many units to
resolve between each tic mark on the plotting grid. This is only
useful when plotting math functions and does not apply when
plotting data sets. For example if you graph a function with many
peaks and valleys you may have a coarse looking plot with jagged
edges when connected by lines. Increase the Res factor to smooth
the plot. High Res values increase plotting time greatly. Again,
Res determines how many times per tic mark to sample the given
function values.
Zooming
'XZm' and 'YZm' determine the zoom factors in each
dimension. 'ZoomIn' and ZoomOut' do the actual zooming of the
grid area.
To zoom in on any one particular area of the graph, select
the 'ZoomIn' gadget. Next place the mouse pointer over the center
of the part you want to zoom in on. Click the left mouse button
to perform the zoom. 'ZoomOut' works the same as 'ZoomIn'.
Tic Marks
The entry gadget titled 'Tics' involves tic mark spacing on
the grid. This has to do with the number of tics(divisions)
between the minimums and maximums for each axis. This gadget is
affected by the menu toggle 'Display/Tic Marks'. If the menu
toggle is set to 'Absolute Tics' and if the 'Tics' gadget is set
to 15 tics per axis, then exactly 15 divisions will be created
between the minimum and maximum of each axis. These divisions
will be rather hard to view since they may be in odd increments
of say, for example, 0.12738 units. A more readable way of
determining tic spacing is by choosing 'Auto Tics' from the
display menu. With 'Auto Tics' the 'Tics' entry gadget only
determines the maximum number of tic marks and the actual number
will usually be less than maximum. 'Auto Tics' will force the tic
mark to the closest factor of 0.2, 0.25, 0.5, or 1.0. If this
scale does not apply to your grid span, then a power of ten
factor is applied to the tic scale.
Ex. Xmin=-15 Xmax=15 -> span=30 units
if Tics=10 then tic increment = 30/10 -> or 3
if 'Absolute Tics' then there will be 10 tic divisions of 3
unit increments( -15 -12 -9 -6 etc. ).
if 'Auto Tics' then there will be 6 tic divisions of 5 unit increments
each.
Center
This gadget allows you to change any current area of the
grid to center. This is useful when you need to slide the grid in
one or both dimensions. To use, select 'Center' then place mouse
pointer over the new center and click the left mouse button.
Default
This button simply changes back to a default function
plotting grid whose dimensions are -10 to 10 units. This is used
by most math texts as a reference coordinate system.
PickVal
Useful for a quick and dirty estimation of a screen points
values. When selected you place the cross hair over the point you
are interested in and click the left mouse button. The values are
printed to the screen. Remember, these values are accurate only
to approximately 1/10 of a tic mark(if there are 10 pixels
between each tic mark).
Find Y
When selected a small window appears. You may enter an 'x'
value for the selected function. Then the function(y) value will
be given. This is an accurate way to find functional values. If a
data set is highlighted when this gadget is called nothing will
happen since data sets are not parsed.
Plot
Starts parsing and plotting of all selected function/data
sets.
Stop
Stops the current function plot. If more than one function
is qued, each will need to be stopped in turn.
Clear
Clears and updates the plot screen and grid.
Line/Point
Determines current plotting mode. Lines will connect the
data points if selected.
MENU FUNCTIONS
File/ Load Parms
After selecting this menu item, a file requestor will be
displayed showing the 'AParms2D' directory listing. Select a
parameter file for loading. Parameter files contain all
information pertinent to a particular function/data environment.
Such info as function definitions or data file names as well as
all plotting parameters are a part of the parm file.
File/ Save Parms
Displays a file requestor for selecting parameter file names
prior to the actual save. You may click on available file names
or type a new name in the 'File' gadget. Click the left mouse
button when the pointer is over the 'OK' gadget to save file.
File/ Load Data
A requestor will allow the selection of a data file name
from the 'Data' directtory. The actual data will be loaded into
the first highlighted function box.
File/ Save Data
A requestor will allow the selection of a data file name
from the 'Data' directory. The file name may be typed into the
'File' gadget. Select 'OK' when ready. Data will be saved from
the first highlighted function gadget. It is a good idea to
highlight only the one function gadget which you wish to save.
File/ Save IFF
A requestor will allow the selection of a file name from the
'Pics' directory. The file name may be typed into the 'File'
gadget. Select 'OK' when ready. The entire screen will be saved
in the IFF format. This file may be viewed with any viewer or
paint program.
File/ Quit
Quit APlot 2D. No data or parameters are saved!
File/ About
About Amiga Plot 2D.
Data/ Sort Data
Sorts data in ascending order for 'X' or 'Y' depending on
submenu selection. Once data has been sorted, it can not be
returned to original order unless the original data file is
reloaded.
Data/ ExchangeXY
Places all 'X' data elements in 'Y' and all 'Y' elements in
'X'. Call this function a second time to place data in original
order.
Display/ Tic Marks
Auto Tics
This function insures that the tic mark divisions will
be in a readable unit of 0.2, 0.25, 0.5 or 1.0, or a power
of ten thereof. The minimum and maximum values will also be
adjusted as well. The 'Tics' gadget value will act as an
upper limit, so the actual number of tics marks will usually
be less.
Absolute Tics
This function insures that the number of tic marks will
match the 'Tics' gadget exactly. The tic factor may be an
odd looking unit such as 0.333 and will not necessarily
yield even tic marks between whole units. Note that 'Auto
Tics' and 'Absolute Tics' are mutually exclusive.
Display/ Grid
Two subitems for grid on or grid off.
Display/ Plot Text
APlot 2D can place up to 8 text items or labels on the
plotting grid at one time. These items are organized in a
separate window and can be toggled on or off at any time. Each
function has a primary label which is the same as its
mathematical representation. Each function has a secondary text
label which can be anything you desire. These two text labels can
be toggled on or off by the 'On/Off' gadgets in the Text window.
Text is not actually displayed until the function itself is
plotted to the grid. When a data file is loaded, the file name
acts as the primary text label. Remember that the primary label
for each function/data set represents the mathematical or file
name that will be parse when the plot function is called!
Display/ Color Map
A color requestor for the screen pallette.
PenColors -
There is a file include called 'PenColors', that APlot 2D
loads on startup. This is a text file that can be altered with an
editor giving the user flexibility to configure colors any way
he/she wishes. This can be very useful(I wish all programs
included such a file) for example if you want a different
arrangement when printing a screen dump. This is not the same as
adjusting the pallette.
The file contains:
1 SDP /* Screen Detail Pen */
0 SBP /* Screen Back Pen */
1 WDP /* Window Detail Pen */
0 WBP /* Window Back Pen */
1 WINDTEXT /* Pen for all text placed in window */
7 WINDBACK /* Backgroud pen for windows */
4 PLOTBACK /* Backgroud pen for main plot window */
5 AXISCOLOR /* pen for drawing axes */
5 GRIDCOLOR /* pen for drawing Grid */
1 FCOLOR /* pen for f(x) */
7 GCOLOR /* pen for g(x) */
6 HCOLOR /* pen for h(x) */
3 ICOLOR /* pen for i(x) */
1 GADTEXT /* pen for any text within a gadget */
7 GADBACK /* pen for background color of gadget box */
2 GADHIGH /* pen for highlight color of gadget box */
1 INTUI_FP /* front pen for menu text */
0 INTUI_BP /* back pen for menu text */
I hope you will help me to make APlot 2D everything you want it
to be.
Sincerely
Joe L. Martin